import http from "../../utils/request"
import qs from 'qs'

//请求角色数据
export const listRole = (params) =>{
  //返回一个promise对象
  //console.log(qs.stringify(params))
  return http.post('/role/listRole',qs.stringify(params));
}
//请求角色数据分页
export const listPageRole = (data) =>{
  return http.post('/role/listPageRole',qs.stringify(data));
}
//添加或修改角色
export const saveOrUpdateRole = (data) =>{
  return http.post('/role/saveOrUpdateRole',qs.stringify(data));
}
//根据角色id查找部门和菜单
export const editRoleAndDeptIdAndMenuId = (data) =>{
  return http.post('/role/editRoleAndDeptIdAndMenuId',qs.stringify(data));
}
//只修改角色表的数据
export const updateById = (data) =>{
  return http.post('/role/updateById',qs.stringify(data));
}
//删除
export const delRole = (data) =>{
  return http('/role/delRole/'+data.roleId);
}

export default {
  listRole,
  listPageRole,
  saveOrUpdateRole,
  editRoleAndDeptIdAndMenuId,
  updateById,
  delRole
}
